BGP logical topology generation method, and device

ABSTRACT

A BGP logical topology generation method includes obtaining, by a controller, node information of a first forwarder and BGP session information of the first forwarder, and obtaining node information of a second forwarder and BGP session information of the second forwarder; and generating, by the controller, a BGP logical topology between the first forwarder and the second forwarder according to the node information and the BGP session information of the first forwarder, and the node information and the BGP session information of the second forwarder that are obtained.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No. 16/407,368 filed on May 9, 2019, which is a continuation of U.S. patent application Ser. No. 15/416,518 filed on Jan. 26, 2017, now U.S. Pat. No. 10,326,664, which is a continuation of International Patent Application No. PCT/CN2015/080425 filed on May 30, 2015, which claims priority to Chinese Patent Application No. 201410374741.6, filed on Jul. 31, 2014. All of the aforementioned patent applications are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present disclosure relates to the communications field, and in particular, to a Border Gateway Protocol (BGP) logical topology generation method, and a device.

BACKGROUND

An Autonomous System (AS) is a small-sized network, in the Internet, capable of autonomously determining a routing protocol that is used in the system. The AS system may be a simple network unit, or may be a network group including multiple network units controlled by at least one network management device.

The BGP is a routing protocol used between AS systems and is mainly used to exchange routing information between the AS systems, so that after obtaining the routing information, a controller builds a propagation path of data between the AS systems.

With unceasing maturity and development of network technologies, centralized network control becomes a future network development trend. There are two types of devices in a centralized control network, a controller and a forwarder. The controller is responsible for performing centralized control on the network and delivering a forwarding entry to the forwarder, and the forwarder performs packet matching and forwarding. In some approaches, no technical solution can effectively implement collection of a BGP logical topology between forwarders by the controller, which is unfavorable for the controller to manage forwarders running the BGP protocol.

SUMMARY

Embodiments of the present disclosure provide a BGP logical topology generation method, and a device, so as to implement collection of a BGP logical topology between forwarders by a controller, and are favorable for the controller to manage forwarders running the BGP protocol.

To achieve the foregoing objective, the following technical solutions are used in the embodiments of the present disclosure.

According to a first aspect, an embodiment of the present disclosure provides a BGP logical topology generation method, where the method is applicable to a network system in which control and forwarding are separated, the network system includes a controller, a first forwarder, and a second forwarder, and a BGP session is established between the first forwarder and the second forwarder; and the method includes obtaining, by the controller, node information of the first forwarder and BGP session information of the first forwarder, where the node information of the first forwarder includes a BGP route identifier (Route-ID) of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs; obtaining, by the controller, node information of the second forwarder and BGP session information of the second forwarder, where the node information of the second forwarder includes a BGP Route-ID of the second forwarder and an autonomous system number of an autonomous system to which the second forwarder belongs; and generating, by the controller, a BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder, where the BGP logical topology between the first forwarder and the second forwarder includes a BGP session relationship between the first forwarder and the second forwarder.

With reference to the first aspect, in a first possible implementation manner, the BGP session information of the first forwarder includes interface address information of the first forwarder for establishing a BGP session, interface address information of the second forwarder that establishes the BGP session with the first forwarder, the autonomous system number of an autonomous system to which the second forwarder belongs, and the Route-ID of the second forwarder; and the BGP session information of the second forwarder includes interface address information of the second forwarder for establishing a BGP session, interface address information of the first forwarder that establishes the BGP session with the second forwarder, the autonomous system number of an autonomous system to which the first forwarder belongs, and the Route-ID of the first forwarder.

With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the generating, by the controller, a BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder includes when the controller determines that both the BGP session information of the first forwarder and the BGP session information of the second forwarder include the Route-ID of the second forwarder, determining that the second forwarder and the first forwarder establish a BGP session; when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are the same, determining that a type of the BGP session established by the first forwarder and the second forwarder is an Internal Border Gateway Protocol (IBGP) session; and when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are different, determining that the type of the BGP session established by the first forwarder and the second forwarder is an External Border Gateway Protocol (EBGP) session; and establishing, by the controller, a BGP session correspondence between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder, so as to form a BGP logical topology between the first forwarder and the second forwarder.

With reference to any one of the first aspect to the second possible implementation manner of the first aspect, in a third possible implementation manner, before the obtaining, by the controller, node information of the first forwarder and BGP session information of the first forwarder, the method further includes establishing, by the controller, a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol; and obtaining, by the controller, the node information of the first forwarder and the BGP session information of the first forwarder by means of the first communication channel.

With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner, the first forwarder and the second forwarder belong to a same autonomous system, and the first forwarder stores the node information of the second forwarder and the BGP session information of the second forwarder; and the method further includes obtaining, by the controller, the node information of the second forwarder and the BGP session information of the second forwarder by means of the first communication channel that is established with the first forwarder.

With reference to any one of the first aspect to the second possible implementation manner of the first aspect, in a fifth possible implementation manner, before the obtaining, by the controller, node information of the second forwarder and BGP session information of the second forwarder, the method further includes establishing, by the controller, a second communication channel with the second forwarder based on the OpenFlow protocol or the Diameter protocol; and obtaining, by the controller, the node information of the second forwarder and the BGP session information of the second forwarder by means of the second communication channel.

According to a second aspect, an embodiment of the present disclosure provides a controller, applied to a network system in which control and forwarding are separated, where the network system includes the controller, a first forwarder, and a second forwarder, and a BGP session is established between the first forwarder and the second forwarder; and the controller includes an obtaining unit configured to obtain node information of the first forwarder and BGP session information of the first forwarder, and obtain node information of the second forwarder and BGP session information of the second forwarder, where the node information of the first forwarder includes a BGP route identifier Route-ID of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs, and the node information of the second forwarder includes a BGP route identifier Route-ID of the second forwarder and an autonomous system number of an autonomous system to which the second forwarder belongs; and a logical topology unit configured to generate a BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder that are obtained by the obtaining unit, where the BGP logical topology between the first forwarder and the second forwarder includes a BGP session relationship between the first forwarder and the second forwarder.

With reference to the second aspect, in a first possible implementation manner, the BGP session information of the first forwarder includes interface address information of the first forwarder for establishing a BGP session, interface address information of the second forwarder that establishes the BGP session with the first forwarder, the autonomous system number of an autonomous system to which the second forwarder belongs, and the Route-ID of the second forwarder; and the BGP session information of the second forwarder includes interface address information of the second forwarder for establishing a BGP session, interface address information of the first forwarder that establishes the BGP session with the second forwarder, the autonomous system number of an autonomous system to which the first forwarder belongs, and the Route-ID of the first forwarder.

With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner, the logical topology unit includes a determining subunit and a connection subunit, where the determining subunit is configured to, when determining that both the BGP session information of the first forwarder and the BGP session information of the second forwarder include the Route-ID of the second forwarder, determine that the second forwarder and the first forwarder establish a BGP session; when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are the same, determine that a type of the BGP session established by the first forwarder and the second forwarder is an IBGP session; and when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are different, determine that the type of the BGP session established by the first forwarder and the second forwarder is an EBGP session; and the connection subunit is configured to establish a BGP session correspondence between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder, so as to form a BGP logical topology between the first forwarder and the second forwarder.

With reference to any one of the second aspect to the second possible implementation manner of the second aspect, in a third possible implementation manner, the controller further includes a first communications unit; the first communications unit is configured to establish a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol; and the obtaining unit is further configured to obtain the node information of the first forwarder and the BGP session information of the first forwarder by means of the first communication channel that is established by the first communications unit.

With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the first forwarder and the second forwarder belong to a same autonomous system, and the first forwarder stores the node information of the second forwarder and the BGP session information of the second forwarder; and the obtaining unit is further configured to obtain the node information of the second forwarder and the BGP session information of the second forwarder by means of the first communication channel that is established with the first forwarder.

With reference to any one of the second aspect to the second possible implementation manner of the second aspect, in a fifth possible implementation manner, the controller further includes a second communications unit; the second communications unit is configured to establish a second communication channel with the second forwarder based on the OpenFlow protocol or the Diameter protocol; and the obtaining unit is further configured to obtain the node information of the second forwarder and the BGP session information of the second forwarder by means of the second communication channel that is established by the second communications unit.

In the BGP logical topology generation method provided in the embodiments of the present disclosure, by obtaining node information of a first forwarder and BGP session information of the first forwarder and obtaining node information of a second forwarder and BGP session information of the second forwarder, a BGP logical topology between the first forwarder and the second forwarder is generated. The method can implement collection of a BGP logical topology between forwarders by a controller, which is favorable for the controller to manage forwarders running the BGP protocol.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly describes the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

FIG. 1 is a schematic flowchart of a BGP logical topology generation method according to an embodiment of the present disclosure;

FIG. 2 is a schematic structural diagram of a network system according to an embodiment of the present disclosure;

FIG. 3 is a schematic structural diagram of another network system according to an embodiment of the present disclosure;

FIG. 4 is a schematic structural diagram of still another network system according to an embodiment of the present disclosure;

FIG. 5 is a schematic structural diagram of a controller according to an embodiment of the present disclosure; and

FIG. 6 is a schematic structural diagram of a controller according to another embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

The following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. The described embodiments are merely some but not all of the embodiments of the present disclosure. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

An embodiment of the present disclosure provides a BGP logical topology generation method. The method is applicable to a network system in which control and forwarding are separated. Optionally, the network system includes a controller, a first forwarder, and a second forwarder, and a BGP session is established between the first forwarder and the second forwarder. Referring to FIG. 1, the method includes the following steps.

101. The controller obtains node information of the first forwarder and BGP session information of the first forwarder, where the node information of the first forwarder includes a BGP route identifier Route-ID of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs.

102. The controller obtains node information of the second forwarder and BGP session information of the second forwarder, where the node information of the second forwarder includes a BGP Route-ID of the second forwarder and an autonomous system number of an autonomous system to which the second forwarder belongs.

The node information of the first forwarder includes the BGP Route-ID of the first forwarder and the autonomous system number of an autonomous system to which the first forwarder belongs, and the node information of the second forwarder includes the BGP Route-ID of the second forwarder and the autonomous system number of an autonomous system to which the second forwarder belongs.

Optionally, before the obtaining, by the controller, node information of the first forwarder and BGP session information of the first forwarder, the method further includes establishing, by the controller, a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol; and obtaining, by the controller, the node information of the first forwarder and the BGP session information of the first forwarder by means of the first communication channel.

Optionally, before the obtaining, by the controller, node information of the second forwarder and BGP session information of the second forwarder, the method further includes establishing, by the controller, a second communication channel with the second forwarder based on the OpenFlow protocol or the Diameter protocol; and obtaining, by the controller, the node information of the second forwarder and the BGP session information of the second forwarder by means of the second communication channel.

Optionally, the controller establishes the first communication channel and the second communication channel in the following two manners.

A first manner referring to FIG. 2, a network system in FIG. 2 includes two areas. Certainly, the two areas are used as an example herein for description. However, it does not indicate that the network system in this embodiment can include only two areas. A first area belongs to an autonomous system X, and a second area belongs to an autonomous system Y. In a same autonomous system, the IBGP is used for data transmission between forwarders. Between different autonomous systems, as shown in FIG. 2, between the autonomous system X and the autonomous system Y, the EBGP is used for data transmission between nodes. In the network system shown in FIG. 2, a first forwarder and a second forwarder both belong to the autonomous system X. The first forwarder stores node information of the second forwarder and BGP session information of the second forwarder. The controller establishes a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol. The controller obtains node information of the first forwarder and BGP session information of the first forwarder by means of the first communication channel, and obtains the node information of the second forwarder and the BGP session information of the second forwarder by means of the first communication channel.

A second manner referring to FIG. 3, a network system in FIG. 3 includes a first autonomous system and a second autonomous system. A first forwarder belongs to an autonomous system X, and a second forwarder belongs to an autonomous system Y. The controller establishes a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol. The controller obtains node information of the first forwarder and BGP session information of the first forwarder by means of the first communication channel. The controller establishes a second communication channel with the second forwarder based on the OpenFlow protocol or the Diameter protocol. The controller obtains node information of the second forwarder and BGP session information of the second forwarder by means of the second communication channel.

Certainly, like application scenarios shown in FIG. 2 and FIG. 3, there may be multiple forwarders in a network system. This is not limited in the present disclosure.

Optionally, in an application scenario, node information of a first forwarder and node information of a second forwarder may further include a protocol type identifier. The protocol type identifier is used to indicate a protocol that is used when the forwarder performs data transmission.

Further optionally, as shown in table 1, a protocol type may be one of the Intermediate System to Intermediate System Routing Protocol (IS-IS), the Open Shortest Path First (OSPF) protocol, the Direct (direct routing) protocol, the Static (static routing) protocol, or the BGP. Certainly, protocols of these several types are used an example herein for description, and it does not indicate that a protocol type of a node in this embodiment can be only these several protocols.

TABLE 1 Protocol type identifier Protocol name 0 other protocols 1 IS-IS of Level 1 2 IS-IS of Level 2 3 OSPF 4 Direct 5 Static 6 BGP

In addition, optionally, the BGP session information of the first forwarder may include interface address information of the first forwarder for establishing a BGP session, interface address information of the second forwarder that establishes the BGP session with the first forwarder, the Route-ID of the second forwarder, and the AS number of an AS to which the second forwarder belongs. The BGP session information of the second forwarder includes interface address information of the second forwarder for establishing a BGP session, interface address information of the first forwarder that establishes the BGP session with the second forwarder, the AS number of an AS to which the first forwarder belongs, and the Route-ID of the first forwarder. Optionally, the BGP session information may further include one or more of an address family identifier AFI/subsequent address family identifier SAFI, a Route Reflector (RR) mark, or a next-hop-local mark. Specifically, optionally, the Route-ID may be an Internet Protocol Version 4 (IPV4) address or an Internet Protocol Version 6 (IPV6) address. Certainly, the IPV4 and the IPV6 protocols are used as an example herein for description, but this embodiment is not limited thereto. The AFI is used to indicate a route type, the SAFI is used to indicate a propagation type, the RR mark is used to indicate that an RR is on one end of a link described in link description information, and the next-hop-local mark is used to indicate that a next node of data transmission is a local node.

Referring to table 2 and table 3, table 2 shows content included in node information, and table 3 shows content included in BGP session information. Certainly, table 2 and table 3 are only forms of exemplarily describing the node information and the BGP session information, and it does not indicate that this embodiment is limited thereto.

TABLE 2 Type Subfield Numerical value Protocol type identifier None 6 . . . Node information AS number X Route-ID 1.1.1.1

With reference to the protocol type identifier in table 1, in table 2, that the protocol type is 6 indicates that the node uses the BGP protocol, and that the AS number is X indicates that the node belongs to the autonomous system X.

TABLE 3 Type Subfield Numerical value Protocol type None 6 identifier . . . Information AS number X about a Route-ID 3.3.3.3 local node Information AS number X about a Route-ID 1.1.1.1 remote node BGP session Interface address 3.3.3.3 information of the local node Interface address 1.1.1.1 of the remote node AFI/SAFI AFI = 1 and SAFI = 4 Next-hop-local mark Enable

Referring to content in table 3, optionally, the first forwarder may be a local node, and the second forwarder is a remote node; or the first forwarder is a remote node, and the second forwarder is a local node.

With reference to the protocol type identifier in table 1, in table 3, that the protocol type identifier is 6 indicates that a protocol used by the node is the BGP protocol; an AS number of the local node and an AS number of the remote node are both identifiers X, that is, the local node and the remote node both belong to the autonomous system X; AFI=1 indicates that an internet protocol used by the link is the IPV4, SAFI=4 indicates that a manner for the link to propagate data is multicast, and that a next-hop-local-node mark is Enable indicates that the next hop of the link is a local node.

103. The controller generates a BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder, where the BGP logical topology between the first forwarder and the second forwarder includes a BGP session relationship between the first forwarder and the second forwarder.

Specifically, the controller generates the BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder. The BGP logical topology between the first forwarder and the second forwarder includes the BGP session relationship between the first forwarder and the second forwarder.

Specifically, when determining that both the BGP session information of the first forwarder and the BGP session information of the second forwarder include the Route-ID of the second forwarder, the controller determines that the second forwarder and the first forwarder establish a BGP session; when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are the same, the controller determines that a type of the BGP session established by the first forwarder and the second forwarder is an IBGP session; and when determining that the autonomous system number of an autonomous system to which the first forwarder belongs and the autonomous system number of an autonomous system to which the second forwarder belongs are different, the controller determines that the type of the BGP session established by the first forwarder and the second forwarder is an EBGP session. The controller establishes a BGP session correspondence between the first forwarder and the second forwarder according to the Route-ID and the autonomous system number of the first forwarder, the BGP session information of the first forwarder, the Route-ID and the autonomous system number of the second forwarder, and the BGP session information of the second forwarder, so as to form the BGP logical topology between the first forwarder and the second forwarder. Then, the controller may learn the BGP session information between the first forwarder and the second forwarder. In the foregoing manner for obtaining the BGP logical topology between the first forwarder and the second forwarder, the controller may further obtain BGP session information among all forwarders in a network managed by the controller, and generate a BGP logical topology among all forwarders running the BGP protocol in the network, which is favorable for the controller to perform BGP session management and maintenance on the forwarders running the BGP protocol.

Certainly, the BGP logical topology generation method provided in the present disclosure may also be applied to a network system including multiple network nodes. As shown in FIG. 4, the network system may be a Seamless Multi-Protocol Label Switching (Seamless MPLS) network, including an autonomous system X and an autonomous system Y. A controller 1 may be a main controller, and the controller 1 manages the autonomous system X and the autonomous system Y by means of a controller 2 and a controller 3. The controller 2 may be a Mobile Backhaul Controller (MBH Controller). The controller 2 may obtain node information and BGP session information of each forwarder in the autonomous system X by means of a communication channel established with a forwarder B. The controller 3 may be a core controller, and the controller 3 may obtain node information and BGP session information of each forwarder in the autonomous system Y by means of a communication channel established with a forwarder E; or the controller 2 and the controller 3 obtain node information and BGP session information of each forwarder by means of a communication channel established with each forwarder in the autonomous system X and the autonomous system Y. Specifically, a forwarder A may be an Access Gateway Route Reflector (AG-RR), a forwarder C and the forwarder E may be Autonomous System Border Router (ASBR), and a forwarder D may be a Core Network Route Reflector (CN-RR).

For specific content of the node information and BGP session information of each forwarder, refer to description of step 101 in the embodiment corresponding to FIG. 1, and details are not described herein. In the network system shown in FIG. 4, the forwarder A and the forwarder B are in a same autonomous system, and the node information of the forwarder A and the node information of the forwarder B have a same autonomous system number. Therefore, a type of a BGP session established by the forwarder A and the forwarder B is an IBGP session, and other forwarders in the autonomous system X may also establish an IBGP session with each other. The forwarder B and the forwarder C are located in different autonomous systems, and the node information of the forwarder B and the node information of the forwarder C have different autonomous system numbers. Therefore, a type of a BGP session established by the forwarder B and the forwarder C is an EBGP session, and forwarders respectively located in the autonomous system X and the autonomous system Y may also establish an EBGP session with each other. The controller 1 may obtain a BGP logical topology among the forwarder A, the forwarder B, the forwarder C, the forwarder D, and the forwarder E by referring to the method of FIG. 1.

In the BGP logical topology generation method provided in this embodiment, a controller establishes a control channel with a forwarder, then obtains node information of a first forwarder and BGP session information of the first forwarder, obtains node information of a second forwarder and BGP session information of the second forwarder, and generates a BGP logical topology between the first forwarder and the second forwarder. The method can implement collection of a BGP logical topology between forwarders by the controller, which is favorable for the controller to manage forwarders running the BGP protocol.

With reference to the foregoing embodiment corresponding to FIG. 1, an embodiment of the present disclosure provides a controller. The controller may be configured to perform the method described in the foregoing embodiment corresponding to FIG. 1, and is applied to a network system in which control and forwarding are separated. The network system includes the controller, a first forwarder, and a second forwarder, and a BGP session is established between the first forwarder and the second forwarder. Referring to FIG. 5, the controller 50 includes an obtaining unit 501 and a logical topology unit 502.

The obtaining unit 501 is configured to obtain node information of the first forwarder and BGP session information of the first forwarder, and obtain node information of the second forwarder and BGP session information of the second forwarder, where the node information of the first forwarder includes a BGP Route-ID of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs, and the node information of the second forwarder includes a BGP Route-ID of the second forwarder and an autonomous system number of an autonomous system to which the second forwarder belongs; and the logical topology unit 502 is configured to generate a BGP logical topology between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder that are obtained by the obtaining unit 501, where the BGP logical topology between the first forwarder and the second forwarder includes a BGP session relationship between the first forwarder and the second forwarder.

Optionally, the BGP session information of the first forwarder includes interface address information of the first forwarder for establishing a BGP session, interface address information of the second forwarder that establishes the BGP session with the first forwarder, the autonomous system number of an autonomous system to which the second forwarder belongs, and the Route-ID of the second forwarder.

The BGP session information of the second forwarder includes interface address information of the second forwarder for establishing a BGP session, interface address information of the first forwarder that establishes the BGP session with the second forwarder, the autonomous system number of an autonomous system to which the first forwarder belongs, and the Route-ID of the first forwarder.

Specifically, optionally, the logical topology unit 502 includes a determining subunit 5021 and a connection subunit 5022.

The determining subunit 5021 is configured to when determining that both the BGP session information of the first forwarder and the BGP session information of the second forwarder include the Route-ID of the second forwarder, determine that the second forwarder and the first forwarder establish a BGP session.

The connection subunit 5022 is configured to establish a BGP session correspondence between the first forwarder and the second forwarder according to the node information of the first forwarder, the BGP session information of the first forwarder, the node information of the second forwarder, and the BGP session information of the second forwarder, so as to form a BGP logical topology between the first forwarder and the second forwarder.

Optionally, in an application scenario, the controller 50 further includes a first communications unit 503.

The first communications unit 503 is configured to establish a first communication channel with the first forwarder based on the OpenFlow protocol or the Diameter protocol.

The obtaining unit 501 is further configured to obtain the node information of the first forwarder and the BGP session information of the first forwarder by means of the first communication channel that is established by the first communications unit 503.

Further optionally, the first forwarder and the second forwarder belong to a same autonomous system, and the first forwarder stores the node information of the second forwarder and the BGP session information of the second forwarder.

The obtaining unit is further configured to obtain the node information of the second forwarder and the BGP session information of the second forwarder by means of the first communication channel that is established with the first forwarder.

Optionally, in another application scenario, the controller 50 further includes a second communications unit 504.

The second communications unit 504 is configured to establish a second communication channel with the second forwarder based on the OpenFlow protocol or the Diameter protocol.

The obtaining unit 501 is further configured to obtain the node information of the second forwarder and the BGP session information of the second forwarder by means of the second communication channel that is established by the second communications unit 504.

This embodiment provides a controller. The controller establishes a control channel with a forwarder, obtains node information of a first forwarder and BGP session information of the first forwarder, obtains node information of a second forwarder and BGP session information of the second forwarder, and generates a BGP logical topology between the first forwarder and the second forwarder. The controller can implement collection of a BGP logical topology between forwarders by the controller, which is favorable for the controller to manage forwarders running the BGP protocol.

Another embodiment of the present disclosure provides a controller 60, and the controller may be configured to perform the method described in the foregoing embodiment corresponding to FIG. 1. Referring to FIG. 6, the device may be built in or may be a micro-processing computer, for example, a general-purpose computer, a customized computer, or a portable device such as a mobile phone terminal or a tablet computer. The controller 60 includes at least one processor 601, a memory 602, a bus 603, a transmitter 604, and a receiver 605. The at least one processor 601, the memory 602, the transmitter 604, and the receiver 605 are connected by using the bus 603 and complete communication between each other.

The bus 603 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture, (EISA) bus, or the like. The bus 603 may be an address bus, a data bus, a control bus, or the like. For ease of representation, the bus in FIG. 6 is represented by using only one bold line, but it does not indicate that there is only one bus or only one type of bus.

The memory 602 is configured to execute application program code of the solution of the present disclosure, where the executed application program code of the solution of the present disclosure is stored in the memory, and is controlled by the processor 601 to be executed.

The memory may be a read-only memory ROM or another type of static storage device that can store static information and an instruction, or a random access memory RAM or another type of dynamic storage device that can store information and an instruction, and may also be an electrically erasable programmable read-only memory EEPROM, a compact disc read-only memory CD-ROM or other optical disk storage, optical disc storage (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, and the like), a magnetic disk storage medium or another magnetic storage device, or any other medium that can be used to carry or store expected program code in a form of an instruction or a data structure and can be accessed by a computer, but the present disclosure is not limited thereto. These memories are connected to the processor by using the bus.

The processor 601 may be a Central Processing Unit (CPU) or an Application Specific Integrated Circuit (ASIC), or may be one or more integrated circuits configured to implement the embodiments of the present disclosure.

The processor 601 is configured to invoke the program code in the memory 602 to perform operations of the obtaining unit and the logical topology unit in the foregoing device embodiment corresponding to FIG. 5. For specific descriptions, refer to the device embodiment corresponding to FIG. 5, and details are not described herein again.

With descriptions of the foregoing embodiments, a person skilled in the art may clearly understand that the present disclosure may be implemented by hardware, firmware or a combination thereof. When the present disclosure is implemented by software, the foregoing functions may be stored in a computer-readable medium or transmitted as one or more instructions or code in the computer-readable medium. The computer-readable medium includes a computer storage medium and a communications medium, where the communications medium includes any medium that enables a computer program to be transmitted from one place to another. The storage medium may be any available medium accessible to a computer. Examples of the computer-readable medium include but are not limited to a Random Access Memory (RAM), a Read-Only Memory (ROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, a disk storage medium or other disk storage, or any other medium that can be used to carry or store expected program code in a command or data structure form and can be accessed by a computer. In addition, any connection may be appropriately defined as a computer-readable medium. For example, if software is transmitted from a website, a server or another remote source by using a coaxial cable, an optical fiber/cable, a twisted pair, a Digital Subscriber Line (DSL) or wireless technologies such as infrared ray, radio and microwave, the coaxial cable, optical fiber/cable, twisted pair, DSL or wireless technologies such as infrared ray, radio and microwave are included in fixation of a medium to which they belong. For example, a disk and a disc used by the present disclosure include a Compact Disc (CD), a laser disc, an optical disc, a Digital Versatile Disc (DVD), a floppy disk and a Blu-ray disc. The disk generally copies data by a magnetic means, and the disc copies data optically by a laser means. The foregoing combination should also be included in the protection scope of the computer-readable medium.

The foregoing descriptions are merely specific embodiments of the present disclosure, but are not intended to limit the protection scope of the present disclosure. Any variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in the present disclosure shall fall within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims. 

What is claimed is:
 1. A method of Border Gateway Protocol (BGP) topology generation, implemented by a controller, and comprising: obtaining first BGP topology information of a first forwarder; obtaining second BGP topology information of a second forwarder, wherein the first BGP topology information and the second BGP topology information are associated with a BGP session between the first forwarder and the second forwarder; and generating a BGP topology based on the first BGP topology information and the second BGP topology information, wherein the BGP topology comprises a BGP session relationship between the first forwarder and the second forwarder.
 2. The method of claim 1, wherein the first BGP topology information comprises interface address information of the first forwarder, interface address information of the second forwarder, a second autonomous system number of a second autonomous system to which the second forwarder belongs, and a second BGP route identifier (route-ID) of the second forwarder, and wherein the second BGP topology information comprises the interface address information of the second forwarder, the interface address information of the first forwarder, a first autonomous system number of a first autonomous system to which the first forwarder belongs, and a first BGP Route-ID of the first forwarder.
 3. The method of claim 1, wherein the first BGP topology information comprises first node information of the first forwarder, and wherein the second BGP topology information comprises second node information of the second forwarder.
 4. The method of claim 3, wherein the first node information comprises a first BGP route identifier (route-ID) of the first forwarder and a first autonomous system number of a first autonomous system to which the first forwarder belongs, and wherein the second node information comprises a second BGP Route-ID of the second forwarder and a second autonomous system number of a second autonomous system to which the second forwarder belongs.
 5. The method of claim 1, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are the same, and wherein a type of the BGP session is an Internal Border Gateway Protocol (IBGP) session.
 6. The method of claim 1, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are different, and wherein a type of the BGP session is an External Border Gateway Protocol (EBGP) session.
 7. The method of claim 1, wherein before obtaining the first BGP topology, the method further comprises: establishing a first communication channel with the first forwarder; and obtaining the first BGP topology information by the first communication channel.
 8. The method of claim 7, wherein the first forwarder and the second forwarder belong to a same autonomous system, wherein the first forwarder stores the second BGP topology information of the second forwarder, and wherein the method further comprises obtaining second BGP topology information using the first communication channel.
 9. The method of claim 1, further comprising obtaining a route reflector (RR) mark from the first forwarder, wherein the RR mark indicates the first forwarder is an RR.
 10. The method of claim 1, further comprising obtaining a next-hop-local-node mark from the first forwarder, wherein the next-hop-local-node mark indicates the first forwarder is a next hop of data transmission from the second forwarder to the first forwarder.
 11. A controller comprising: a memory configured to store instructions; and a processor coupled to the memory and configured to execute the instructions to cause the controller to: obtain first BGP topology information of a first forwarder; obtain second BGP topology information of a second forwarder, wherein the first BGP topology information and the second BGP topology information are associated with a BGP session between the first forwarder and the second forwarder; and generate a BGP topology based on the first BGP topology information and the second BGP topology information, wherein the BGP topology comprises a BGP session relationship between the first forwarder and the second forwarder.
 12. The controller of claim 11, wherein the first BGP topology information comprises interface address information of the first forwarder, interface address information of the second forwarder, a second autonomous system number of a second autonomous system to which the second forwarder belongs, and a second BGP Route-ID of the second forwarder, and wherein the second BGP topology information comprises the interface address information of the second forwarder, the interface address information of the first forwarder, a first autonomous system number of a first autonomous system to which the first forwarder belongs, and a first BGP Route-ID of the first forwarder.
 13. The controller of claim 11, wherein the first BGP topology information comprises a first node information of the first forwarder, and wherein the second BGP topology information comprises a second node information of the second forwarder.
 14. The controller of claim 13, wherein the first node information comprises a first BGP route identifier (Route-ID) of the first forwarder and a first autonomous system number of a first autonomous system to which the first forwarder belongs, and wherein the second node information comprises a second BGP Route-ID of the second forwarder and a second autonomous system number of a second autonomous system to which the second forwarder belongs.
 15. The controller of claim 11, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are the same, and wherein a type of the BGP session is an Internal Border Gateway Protocol (IBGP) session.
 16. The controller of claim 11, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are different, and wherein a type of the BGP session is an External Border Gateway Protocol (EBGP) session.
 17. The controller of claim 11, wherein the processor is further configured to execute the instructions to cause the controller to: establish a first communication channel with the first forwarder; and obtain the first BGP topology information of the first forwarder by the first communication channel.
 18. The controller of claim 17, wherein the first forwarder and the second forwarder belong to a same autonomous system, wherein the first forwarder stores the second BGP topology information of the second forwarder, and wherein the processor is further configured to execute the instructions to cause the controller to obtain the second BGP topology information of the second forwarder using the first communication channel.
 19. The controller of claim 11, wherein the processor is further configured to execute the instructions to cause the controller to obtain a route reflector (RR) mark from the first forwarder, and wherein the RR mark indicates the first forwarder is the RR.
 20. The controller of claim 11, wherein the processor is further configured to execute instructions to cause the controller to obtain a next-hop-local-node mark from the first forwarder, and wherein the next-hop-local-node mark indicates the first forwarder is a next hop of data transmission from the second forwarder to the first forwarder.
 21. A first forwarder comprising: a memory configured to store instructions; and a processor coupled to the memory and configured to execute the instructions to cause the first forwarder to: establish a BGP session with a second forwarder; and send first BGP topology information of the first forwarder to a controller, wherein the first BGP topology information is associated with the BGP session, and wherein the first BGP topology information is for generating a BGP topology comprising a BGP session relationship between the first forwarder and a second forwarder.
 22. The first forwarder of claim 21, wherein the first BGP topology information comprises interface address information of the first forwarder, interface address information of the second forwarder, an autonomous system number of an autonomous system to which the second forwarder belongs, and a BGP route identifier (route-ID) of the second forwarder.
 23. The first forwarder of claim 21, wherein the first BGP topology information comprises first node information of the first forwarder.
 24. The first forwarder of claim 23, wherein the first node information comprises a BGP route identifier (route-ID) of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs.
 25. The first forwarder of claim 21, wherein the processor is further configured to execute the instructions to cause the first forwarder to send a route reflector (RR) mark to the controller, and wherein the RR mark indicates the first forwarder is a RR.
 26. The first forwarder of claim 21, wherein the processor is further configured to execute the instructions to cause the first forwarder to send a next-hop-local-node mark to the controller, and wherein the next-hop-local-node mark indicates the first forwarder is a next hop of data transmission from the second forwarder to the first forwarder.
 27. A method of Border Gateway Protocol (BGP) topology generation, implemented by a first forwarder, and comprising: establishing a BGP session with a second forwarder; and sending first BGP topology information of the first forwarder to a controller, wherein the first BGP topology information is associated with the BGP session, and wherein the first BGP topology information is for generating a BGP topology comprising a BGP session relationship between the first forwarder and a second forwarder.
 28. The method of claim 27, wherein the first BGP topology information comprises interface address information of the first forwarder, interface address information of the second forwarder, an autonomous system number of an autonomous system to which the second forwarder belongs, and a BGP route identifier (route-ID) of the second forwarder.
 29. The method of claim 27, wherein the first BGP topology information comprises first node information of the first forwarder.
 30. The method of claim 29, wherein the first node information comprises a BGP route identifier (route-ID) of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs.
 31. The method of claim 27, further comprising sending a route reflector (RR) mark to the controller, wherein the RR mark indicates the first forwarder is a RR.
 32. The method of claim 27, further comprising sending a next-hop-local-node mark to the controller, wherein the next-hop-local-node mark indicates the first forwarder is a next hop of data transmission from the second forwarder to the first forwarder.
 33. A system comprising: a second forwarder; a first forwarder configured to: establish a BGP session between with the second forwarder; and send first BGP topology information of the first forwarder, wherein the first BGP topology information is associated with the BGP session; a controller configured to: receive the first BGP topology information from the first forwarder; obtain second BGP topology information of the second forwarder; and generate a BGP topology based on the first BGP topology information and the second BGP topology information, wherein the BGP topology comprises a BGP session relationship between the first forwarder and the second forwarder.
 34. The system of claim 33, wherein the first BGP topology information comprises interface address information of the first forwarder, interface address information of the second forwarder, an autonomous system number of an autonomous system to which the second forwarder belongs, and a BGP route identifier (route-ID) of the second forwarder.
 35. The system of claim 33, wherein the first BGP topology information comprises first node information of the first forwarder.
 36. The system of claim 35, wherein the first node information comprises a BGP route identifier (route-ID) of the first forwarder and an autonomous system number of an autonomous system to which the first forwarder belongs.
 37. The system of claim 33, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are the same, and wherein a type of the BGP session is an Internal Border Gateway Protocol (IBGP) session.
 38. The system of claim 33, wherein a first autonomous system number of a first autonomous system to which the first forwarder belongs and a second autonomous system number of a second autonomous system to which the second forwarder belongs are different, and wherein a type of the BGP session is an External Border Gateway Protocol (EBGP) session. 